let request = require('../../utils/request.js')
Page({
    data:{
      userID:null,
      detailList:[],
      total: 1,      
      pagenumber: 1 
    },
    onShow() {
      my.getNetworkType({
        success: (res) => {
          if(!res.networkAvailable||res.networkType=='UNKNOWN'){
            my.showToast({
              content: '网络状态不佳，请检查网络',
              type:'fail',
              duration: 2000
            })
          }
        }
      })
      this.getuserinfo()
     
    },
     //获取用户信息
  getuserinfo() {
    let success = (res) => {
      this.data.userID=res.id
      this.getlist()
    }
    request.getdata("/users/user/show", {}, success, this);
  },
  //获取钱包明细列表
  getlist() {
    let url = '/user/'+this.data.userID+'/pocket/histories';
    let success = (res) => {
      this.data.detailList=res.data
      this.setData({
        detailList: this.data.detailList
      })
    }
    request.getdata(url, {"pagination":this.data.pagenumber}, success, this);
  },
})